/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Principal;


import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import sofia.Persistencia.DAOS.FachadaBD;
/**
 *
 * @author crisfalt
 */
public class SingletonDB {

        private static final String UNIDADPERSISTENCIA = "SofiaPU";
        private static final int SERVIDORMYSQL = 1;
        public static EntityManagerFactory managerFactory;
        public static FachadaBD objFachadaBD;
        private static SingletonDB instanciaUnica;

        public SingletonDB() {
                managerFactory = Persistence.createEntityManagerFactory( UNIDADPERSISTENCIA );
                objFachadaBD = new FachadaBD( SERVIDORMYSQL );
        }

        public static SingletonDB getInstanciaUnica() {
                if( instanciaUnica == null ) {
                        instanciaUnica = new SingletonDB();
                }
                return instanciaUnica;
        }

}
